<ul nz-menu [nzMode]="'horizontal'" class="nav">
    <li nz-menu-item class="" routerLink="/widgets/widgets" [routerLinkActive]="['ant-menu-item-selected']"
        style="outline: none">
        <a style="outline: none">班级管理</a>
    </li>
    <li nz-menu-item routerLink="/widgets/student" [routerLinkActive]="['ant-menu-item-selected']"
        style="outline: none">
        <a style="outline: none">学生管理</a>
    </li>
</ul>

<div style="padding:15px 0">
    <nz-input [nzPlaceHolder]="'请输入您要搜索的班级名'" [(ngModel)]="_value" style="width: 300px;margin-right: 10px"></nz-input>
    <button nz-button [nzType]="'primary'" (click)="doSearch()">搜索</button>

</div>
<nz-table #nzTable [nzAjaxData]="data" [(nzPageIndex)]="pi" [(nzPageSize)]="ps" [nzLoading]="loading" [nzTotal]='Total'
          (nzDataChange)="dataChange($event)"
          (nzPageIndexChange)="pageChange($event)">

    <thead nz-thead>
    <tr>
        <!--<th nz-th [nzCheckbox]="true">-->
        <!--<label nz-checkbox [(ngModel)]="allChecked" [nzIndeterminate]="indeterminate"-->
        <!--(ngModelChange)="checkAll($event)"></label>-->
        <!--</th>-->
        <th nz-th><span>班级名称</span></th>
        <th nz-th><span>已加入学生数</span></th>
        <th nz-th><span>已关联项目</span>
        </th>
        <th nz-th><span>班级审核</span>
        </th>
        <th nz-th><span>操作</span></th>
    </tr>
    </thead>
    <tbody nz-tbody>
    <tr nz-tbody-tr *ngFor="let data of nzTable.data">
        <!--<td nz-td [nzCheckbox]="true">-->
        <!--<label nz-checkbox  [(ngModel)]="i.checked" (ngModelChange)="refreshStatus($event)">-->
        <!--</label>-->
        <!--</td>-->
        <td nz-td>{{data.cla_name}}</td>
        <td nz-td><span (click)="showStuTotal(data)" style="cursor: pointer;color:#c00000">{{data.stuTotal}}/{{data.count}}</span></td>
        <td nz-td><span (click)="showProTotal(data.cla_id)" style="cursor: pointer;color:#c00000">{{data.projectTotal}}</span></td>
        <td nz-td><span (click)="showCheckModal(data)" style="cursor: pointer;color:#c00000">{{data.checkTotal}}</span>
        </td>

        <td nz-td>
            <a (click)="edit(data)">修改</a>
            <!--<span nz-table-divider></span>-->
            <!--<a (click)="isDelTec(data)">删除</a>-->
        </td>
    </tr>
    </tbody>
</nz-table>

<nz-modal [nzWrapClassName]="'vertical-center-modal'" [nzFooter]="'true'" [nzVisible]="stuModal" [nzTitle]="'查看学生'"
          [nzConfirmLoading]="loading" [nzContent]="mojorContent4"
          (nzOnCancel)="stuModal=false" (nzOnOk)="stuModal=false" [nzStyle]="style" [nzOkText]="'确定'"
          [nzCancelText]="'取消'">
    <ng-template #mojorContent4>
        <table cellspacing="0" cellpadding="0" border="0" width="100%">
            <tr>
                <td width="20%" align="right" height="50px">班级名称：</td>
                <td>
                    {{ className }}
                </td>
            </tr>
            <tr>
                <td align="right" height="50px">已加入学生：</td>
                <td>
                    <ul style="border:1px solid #ddd;padding: 10px 10px;overflow: auto;max-height: 500px">
                        <li style="float: left;margin:10px;position: relative;" *ngFor="let stu of stuList">
                            <img src="{{ stu.ImagePath ? ip + stu.ImagePath :'./assets/img/defaultUser-img.jpg' }}"
                                 width="50" height="50" style="vertical-align: middle">
                            <div
                                style="display: inline-block;height: 50px;vertical-align: middle;margin-left:8px;width: 100px">
                                <p style="height: 25px;line-height: 25px;font-size: 14px;width: 100%;overflow: hidden;text-overflow: ellipsis;white-space:nowrap ">
                                    {{ stu.UserName }}</p>
                                <p style="height: 25px;line-height: 25px;font-size: 14px;width: 100%;overflow: hidden;text-overflow: ellipsis;white-space:nowrap">
                                    {{ stu.CreateTime.substr(0,10) }}</p>
                            </div>
                            <nz-popconfirm [nzTitle]="'确定要删除这个学生吗？'" (nzOnConfirm)="isDelStu(stu)" [nzOkText]="'确定'"
                                           [nzCancelText]="'取消'" [nzPlacement]="'right'"
                                           style="position: absolute;right: 0;top: 0;cursor: pointer">
                                <i nz-popconfirm class="anticon anticon-close"></i>
                            </nz-popconfirm>
                        </li>
                    </ul>
                </td>
            </tr>
        </table>
    </ng-template>
</nz-modal>
<nz-modal [nzWrapClassName]="'vertical-center-modal'" [nzFooter]="''" [nzVisible]="checkModal" [nzTitle]="'班级审核'"
          [nzConfirmLoading]="loading" [nzContent]="mojorContent3"
          (nzOnCancel)="checkModal=false" (nzOnOk)="checkModal=false" [nzStyle]="style">
    <ng-template #mojorContent3>
        <nz-table #nzTable1 [nzAjaxData]="checkData"  [nzLoading]="loading" [nzIsPagination]="false">
            <thead nz-thead>
            <tr>
                <!--<th nz-th [nzCheckbox]="true">-->
                <!--<label nz-checkbox [(ngModel)]="allChecked1" [nzIndeterminate]="indeterminate1"-->
                <!--(ngModelChange)="checkAll($event)"></label>-->
                <!--</th>-->
                <th nz-th><span>申请人</span></th>
                <th nz-th><span>申请时间</span></th>
                <th nz-th><span>专业</span>
                </th>
                <th nz-th><span>班级</span>
                </th>
                <th nz-th><span>操作</span></th>
            </tr>
            </thead>
            <tbody nz-tbody>
            <tr nz-tbody-tr *ngFor="let data of nzTable1.data">
                <!--<td nz-td [nzCheckbox]="true">-->
                <!--<label nz-checkbox  [(ngModel)]="i.checked" (ngModelChange)="refreshStatus($event)">-->
                <!--</label>-->
                <!--</td>-->
                <td nz-td>{{data.stu_name}}</td>
                <td nz-td>{{data.create_time}}</td>
                <td nz-td>{{data.major_name}}</td>
                <td nz-td>{{data.cla_name}}</td>

                <td nz-td>
                    <nz-popconfirm [nzTitle]="'确定要通过审核？'" (nzOnConfirm)="through(data)" [nzOkText]="'确定'"
                                   [nzCancelText]="'取消'">
                        <a nz-popconfirm>通过</a>
                    </nz-popconfirm>
                    <span nz-table-divider></span>
                    <nz-popconfirm [nzTitle]="'确定要驳回审核？'" (nzOnConfirm)="reject(data)" [nzOkText]="'确定'"
                                   [nzCancelText]="'取消'">
                        <a nz-popconfirm>驳回</a>
                    </nz-popconfirm>
                </td>
            </tr>
            </tbody>
        </nz-table>
    </ng-template>
</nz-modal>
<nz-modal [nzWrapClassName]="'vertical-center-modal'" [nzFooter]="'true'" [nzVisible]="classModal" [nzTitle]="'查看班级'"
          [nzConfirmLoading]="loading" [nzContent]="mojorContent2"
          (nzOnCancel)="classModal=false" (nzOnOk)="saveClass()" [nzStyle]="style1">
    <ng-template #mojorContent2>
        <table cellspacing="0" cellpadding="0" style="width: 80%;">
            <tr>
                <td width="25%" align="right" height="50px">
                    班级名称：
                </td>
                <td>
                    <nz-input [(ngModel)]="className1" [nzPlaceHolder]="'输入班级名称'" (ngModelChange)="classNameChange($event)" ></nz-input>
                </td>
            </tr>
            <tr>
                <td align="right" height="50px">
                    班级人数：
                </td>
                <td>
                    <nz-input [(ngModel)]="classCount" [nzPlaceHolder]="'输入班级人数'" (ngModelChange)="classCountChange($event)"></nz-input>
                </td>
            </tr>
        </table>
    </ng-template>
</nz-modal>
